package com.arch.flink.archetype.sinkprovider;


import java.util.Optional;

/**
 * @author pizhihui
 * @date 2023-08-03 14:02
 */
public interface MySinkProvider extends MyParallelismProvider {

    static MySinkProvider of(MySink<RowData> mySink) {
        return () -> mySink;
    }

    static MySinkProvider of(MySink<RowData> mySink, Integer parallelism) {
        return new MySinkProvider() {
            @Override
            public Optional<Integer> getParallelism() {
                return Optional.of(parallelism);
            }

            @Override
            public MySink<RowData> createSink() {
                return mySink;
            }
        };
    }

    static void info() {
        System.out.println("hello");
    }


    MySink<RowData> createSink();


}
